import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login.vue'
import Home from '@/views/Home.vue'
import User from '@/views/Subs/User.vue'
import System from '@/views/Subs/System.vue'
import Order from '@/views/Subs/Order.vue'
import Access from '@/views/Subs/Access.vue'
import Goods from '@/views/Subs/Goods.vue'
import UserInfo from '@/views/Subs/UserInfo.vue'
import Dept from '@/views/Subs/Dept.vue'
import DeptDetail from '@/views/Subs/DeptDetail.vue'
import Addbox from '@/views/Subs/Addbox.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/home',
      component: Home,
      children: [
        {
          path: '/home',
          redirect: '/home/user'
        },
        {
          path: 'user',
          component: User,
        },
        {
          path: '/home/userInfo/:id',
          component: UserInfo,
        },
        {
          path: 'dept',
          component: Dept,
          children: [
            {
              path: 'addbox',
              component:Addbox
            },
          ]
        },
        {
          path: '/home/deptdetail/:id',
          component: DeptDetail,
        },

        {
          path: 'system',
          component: System,
        },

        {
          path: 'order',
          component: Order,
        },
        {
          path: 'goods',
          component: Goods,
        },
        {
          path: 'access',
          component: Access,
        },
      ]
    },
    {
      path: '/login',
      component: Login
    },
  ],
})

export default router
